<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="949.35">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco}
p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; min-height: 16.0px}
p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Monaco; color: #981c1c}
span.s1 {color: #001dba}
span.s2 {color: #606060}
span.s3 {color: #981c1c}
span.s4 {color: #426f0b}
span.Apple-tab-span {white-space:pre}
</style>
</head>
<body>
<p class="p1"><b>LPCSynth</b></p>
<p class="p1"><b>LPCVals -<span class="Apple-converted-space">    <span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span></span>utilize LPC data</b></p>
<p class="p2"><br></p>
<p class="p3"><b>LPCSynth(buffer, signal, pointer, mul, add)</b></p>
<p class="p3"><b>#cps, rmso, err = LPCVals(buffer, pointer)</b></p>
<p class="p4"><br></p>
<p class="p3"><b>- LPCSynth uses data from a LPC data file to filter a signal</b></p>
<p class="p3"><b>- LPCVals returns pitch, rms and error data from the LPC data file</b></p>
<p class="p4"><br></p>
<p class="p3"><b>buffer - the buffer where data is stored from LPCFile (see LPCFile).</b></p>
<p class="p3"><b>pointer - a pointer into the LPC data file, where 0 is the begining and 1 is the end.</b></p>
<p class="p3"><b>signal - the signal to filter.</b></p>
<p class="p4"><br></p>
<p class="p5"><b>Usage</b></p>
<p class="p4"><br></p>
<p class="p3"><b>This uses the fate.lpc file, created with the following command:</b></p>
<p class="p4"><br></p>
<p class="p3"><b>lpanal -p 50 -h 300 fate.aiff fate.lpc</b></p>
<p class="p4"><br></p>
<p class="p3"><b>-p = num poles</b></p>
<p class="p3"><b>-h = hop size in samples<span class="Apple-converted-space"> </span></b></p>
<p class="p4"><br></p>
<p class="p3"><b>analysis window are 2X the hop size</b></p>
<p class="p4"><br></p>
<p class="p4"><br></p>
<p class="p6">s = <span class="s1">Server</span>.local.boot;</p>
<p class="p7"><br></p>
<p class="p8">// this file came with the JoshUGens... Leonard Bernstein talking about Beethoven.</p>
<p class="p8">// Place it in your SC3/sounds directory.</p>
<p class="p6">a = <span class="s1">LPCFile</span>.new(<span class="s2">"sounds/fate.lpc",</span> server: s).loadToBuffer;</p>
<p class="p7"><br></p>
<p class="p6">(</p>
<p class="p6">z = {</p>
<p class="p6"><span class="s1">var</span> cps, rmso, err, voc, noise, timepoint, dur;</p>
<p class="p6">timepoint = <span class="s1">LFSaw</span>.ar(0.4/a.sndDur, 1, 0.5, 0.5);</p>
<p class="p7"><br></p>
<p class="p6"># cps, rmso, err = <span class="s1">LPCVals</span>.ar(a.buffer, timepoint);</p>
<p class="p8">// a periodic Blip to filter, amplitude is 1 - error</p>
<p class="p6">noise = <span class="s1">WhiteNoise</span>.ar(err); <span class="s3">// a noise source</span></p>
<p class="p7"><br></p>
<p class="p6">voc = Blip.ar(cps, 100);</p>
<p class="p8">// the rms values tend to be high... scale them back quite a bit!</p>
<p class="p6"><span class="s1">Out</span>.ar(0, <span class="s1">LPCSynth</span>.ar(a.buffer, voc + noise, timepoint, rmso));<span class="Apple-converted-space"> </span></p>
<p class="p6">}.play(s)</p>
<p class="p6">)</p>
<p class="p6">z.free;</p>
<p class="p8">// clean up</p>
<p class="p6">s.sendBundle(0.1, [<span class="s4">\b_free</span>, a.buffer]);</p>
<p class="p7"><br></p>
<p class="p7"><br></p>
</body>
</html>
